from toee import *

from utilities import *

from t import hl

from py00439script_daemon import record_time_stamp, get_v, set_v, npc_set, npc_unset, npc_get, tsc, within_rect_by_corners


def san_enter_combat(attachee, triggerer):
	attachee.standpoint_set(STANDPOINT_DAY, attachee.obj_get_int(obj_f_npc_pad_i_3) - 342 + 500)
	attachee.standpoint_set(STANDPOINT_NIGHT, attachee.obj_get_int(obj_f_npc_pad_i_3) - 342 + 500)
	if attachee.obj_get_int(obj_f_npc_pad_i_3) == 361 or attachee.obj_get_int(obj_f_npc_pad_i_3) == 362:
		hl(attachee)
		xx = 482
		yy = 417
		for npc in game.obj_list_vicinity(location_from_axis(xx,yy), OLC_NPC ):
			if npc.leader_get() == OBJ_HANDLE_NULL:
				npc.standpoint_set(STANDPOINT_DAY, npc.obj_get_int(obj_f_npc_pad_i_3) - 342 + 500)
				npc.standpoint_set(STANDPOINT_NIGHT, npc.obj_get_int(obj_f_npc_pad_i_3) - 342 + 500)	
				npc.npc_flag_set(ONF_KOS)
				npc.npc_flag_unset(ONF_KOS_OVERRIDE)
	return RUN_DEFAULT

def san_exit_combat(attachee, triggerer):
	attahcee.standpoint_set(STANDPOINT_DAY, attachee.obj_get_int(obj_f_npc_pad_i_3))
	attahcee.standpoint_set(STANDPOINT_NIGHT, attachee.obj_get_int(obj_f_npc_pad_i_3))
	set_v('Test666', get_v('Test666') | 2 )
	return RUN_DEFAULT